package com.itheima.a04threadmethod1;

public class ThreadDemo {
    public static void main(String[] args) throws InterruptedException {
        //创建线程，除了setNmae的方法以外，还能通过构造方法给线程名赋值
        MyThread m1=new MyThread("飞机");
        MyThread m2=new MyThread("坦克");
//
//        //启动线程
        m1.start();
        m2.start();

        //获取当前线程,默认会开启一条名字为main的线程
//        Thread t=Thread.currentThread();
//        System.out.println(t.getName());

        //线程睡眠
        System.out.println("11111111111111111111111");
        Thread.sleep(5000);
        System.out.println("222222222222222222222222");

    }
}
